# -*-coding:utf-8 -*-

class Point(object):
    def __init__(self,x,y,weigh):
        self.x=x
        self.y=y
        self.weigh=weigh

if __name__ == '__main__':
    points=[]
    for i in range(1,92,1):
        points.append(i)
    print points

    import csv
    ptpCsvFile=file("ptp.csv",'rb')
    ptpReader=csv.reader(ptpCsvFile)

    pointDescFile=file('pointDesc.csv','rb')
    pointDescReader=csv.reader(pointDescFile)

    stirDescFile = file('pointDesc.csv', 'rb')
    stirDescReader = csv.reader(stirDescFile)

    stir_node=[]
    for line in stirDescReader:
        stir_node.append(line[0])
    stirDescFile.close();
    print "stir_node:",stir_node




    # 这个是每一个点坐标和消耗量
    pointLocation={}
    for line in pointDescReader:
        pointLocation[line[0]]=Point(float(line[1]),float(line[2]),line[3])
    # print len(pointLocation)
    # print pointLocation['2'].weigh
    print "pointNum:",len(pointLocation)
    pointDescFile.close()








    # for i in range(1, 20, 1):
    #     if i%2==0:
    #         continue;
    #     print i
    ppdistance = []
    num = 1
    for line in ptpReader:
        # key1=line[0]+','+line[1]
        # key2=line[1]+','+line[0]
        # if key1 in ppdistance or key2 in ppdistance:
        #     continue;
        startLocation=pointLocation[line[0]]
        endLocation=pointLocation[line[1]]
        distance2=pow(abs(startLocation.x-endLocation.x),2)+pow(abs(startLocation.y-endLocation.y),2)
        import math
        distance=math.sqrt(distance2)
        ppdistance.append((line[0],line[1],distance))
        num+=1
        # print line[0],line[1]
    ptpCsvFile.close()
    print '长度：',len(ppdistance)
    # print num
    print ppdistance